<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>ToDo</title>
</head>
<body>


    <div id="app">


        <input type="text" v-model="msg" @keydown.enter="addTodos" >
        <span>{{msg}}</span>
        <ul>
            <li v-for="(it,index) in todos">
                {{it}}
                <button @click="removeTodos(index)">delete</button>
            </li>
        </ul>



    </div>





<script src="../node_modules/vue/dist/vue.js"></script>


<script>

    let vm = new Vue({
        el:'#app',
        data:{
            msg:'',
            todos:[],
        },
        methods:{
            addTodos(){
                this.todos.unshift(this.msg)
                this.msg = ''
            },
            removeTodos(it){
                console.log(it);
                this.todos.splice(it,1)

            }

        }
    })

</script>
</body>
</html>